package com.zhangwei.service.impl;


import com.zhangwei.mapper.HotCityMapper;
import com.zhangwei.pojo.HotCity;

import com.zhangwei.service.HotCityService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class HotCityServiceImpl implements HotCityService {

    @Autowired
    HotCityMapper hotCityMapper;

    @Override
    public List<HotCity> selectAll() {

        List<HotCity> list= hotCityMapper.selectAll();
        return list;
    }

    @Override
    public HotCity selectById(int id) {
        return hotCityMapper.selectById(id);
    }

    @Override
    public int insertOne(HotCity hotCity) {
        log.info("执行增加操作");
        return hotCityMapper.insertOne(hotCity);
    }

    @Override
    public int delById(int id) {

        return hotCityMapper.delById(id);
    }

    @Override
    public int updateOne(HotCity hotCity) {

//        System.out.println("access  update  1111111111");
//        System.out.println(hotCity.getId()+hotCity.getCityName());
        log.info("正在更新数据：{}，{}",hotCity.getId(),hotCity.getCityName());
        return hotCityMapper.updateOne(hotCity);
    }
}
